from fastapi import APIRouter

import models, data_storage

router = APIRouter()


@router.get("/hello")
def hello():
    return {"Hello": "World"}


@router.post("/add")
def add(item: models.MyItem):
    st = data_storage.MyConch()
    return st.add(item)

@router.post("/update")
def update(item: models.MyItem):
    st = data_storage.MyConch()
    return st.update(item)


@router.get("/getall")
def get_all():
    st = data_storage.MyConch()
    return st.get_all()


@router.post("/add_category")
def add_category(item: models.Category):
    st = data_storage.MyConch()
    return st.add_category(item)


@router.get("/get_category")
def get_category():
    st = data_storage.MyConch()
    return st.get_category()
